package com.www.dao.admin;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.www.domain.admin.Authority;

/**
 * 权限实现类dao
 */
@Repository
public interface AuthorityDao {
	/*
	 * 权限插入操作
	 */
	@Insert("insert into authority(id,roleId,menuId) values(default,#{roleId},#{menuId})")
	public int add(Authority authority);
	
	/*
	 * 删除权限信息
	 */
	@Delete("delete from authority where roleId = #{roleId}")
	public int deleteByRoleId(Long roleId);
	
	/*
	 * 权限信息搜索查询
	 */
	@Select({"<script> "+
			"select * from authority " +
			"<if test='_parameter != null'> where roleId = #{roleId}</if>" +
	 		"</script>"})
	public List<Authority> findListByRoleId(Long roleId);
}
